home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / geowindo / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-05-28  |  3.0 KB  |  117 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SampleCE.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "ExampleDialog.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15. // Array tbSTDButton contains relevant buttons of bitmap IDB_STD_SMALL_COLOR
  16.  
  17. static TBBUTTON g_tbSTDButton[] = {
  18.     {0, 0,                TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0, 0,  0},  
  19.     {0,    ID_FILE_NEW,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  20.     {1, ID_FILE_OPEN,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  21.     {2, ID_FILE_SAVE,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  22.     {0, 0,                TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0, 0, -1},
  23.     {3, ID_EDIT_CUT,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  24.     {4, ID_EDIT_COPY,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  25.     {5, ID_EDIT_PASTE,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  26.     {0, 0,                TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0, 0, -1},
  27.     {6, ID_APP_ABOUT,    TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
  28.     {0, 0,                TBSTATE_ENABLED, TBSTYLE_SEP,    0, 0, 0,  0}
  29. };
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CMainFrame
  33.  
  34. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  35.  
  36. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  37.     //{{AFX_MSG_MAP(CMainFrame)
  38.     ON_WM_CREATE()
  39.     ON_COMMAND(ID_EXAMPLE_DIALOG, OnExampleDialog)
  40.     //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42.  
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CMainFrame construction/destruction
  45.  
  46. CMainFrame::CMainFrame()
  47. {
  48.     // TODO: add member initialization code here
  49.     
  50. }
  51.  
  52. CMainFrame::~CMainFrame()
  53. {
  54. }
  55.  
  56. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  57. {
  58.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  59.         return -1;
  60.     
  61.     // Add the buttons to the CommandBar.
  62.     // NOTE: In order for AddAdornments() to work properly, NImages must be
  63.     //       the true number of button images in the bitmap file (even if not
  64.     //       all of them are used).
  65.     if (!InsertButtons( g_tbSTDButton,
  66.         sizeof(g_tbSTDButton)/sizeof(TBBUTTON),        // NButtons
  67.         IDR_MAINFRAME,                    // toolbar bitmap
  68.         7 ))                        // NImages
  69.     {
  70.         TRACE0("Failed to add command bar buttons\n");
  71.         return -1;
  72.     }
  73.  
  74.     // Add Exit button
  75.     if (!AddAdornments(0))
  76.     {
  77.         TRACE0("Failed to add exit button\n");
  78.         return -1;      // fail to create command bar
  79.     }
  80.  
  81.  
  82.     return 0;
  83. }
  84.  
  85. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  86. {
  87.     // TODO: Modify the Window class or styles here by modifying
  88.     //  the CREATESTRUCT cs
  89.  
  90.     return CFrameWnd::PreCreateWindow(cs);
  91. }
  92.  
  93. /////////////////////////////////////////////////////////////////////////////
  94. // CMainFrame diagnostics
  95.  
  96. #ifdef _DEBUG
  97. void CMainFrame::AssertValid() const
  98. {
  99.     CFrameWnd::AssertValid();
  100. }
  101.  
  102. void CMainFrame::Dump(CDumpContext& dc) const
  103. {
  104.     CFrameWnd::Dump(dc);
  105. }
  106.  
  107. #endif //_DEBUG
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // CMainFrame message handlers
  111.  
  112. void CMainFrame::OnExampleDialog() 
  113. {
  114.     CExampleDialog dlg;
  115.     dlg.DoModal();
  116. }
  117.